- /* slmmlp10.cpp by K.Tsuru */
- // function ID = 251 DRADIX
- /*******************************
- SLong class
- It multiply by power of ten.
- *10^p
- p can be negative.
- *******************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
-
- static const char* func = "SL MultPow10";
- SLong& SLong::MultPow10(long p){
- //This is not necessary because an access error occurs for SInteger.
- // if(Type() != DRADIX) SetError(RADIX_ERR, func, 251);
- if(!p) return *this;
- long n = p/DFIGURES, r = p - DFIGURES*n;
- long max_sz = (long)MaxSize();
-
- if(n + (long)aTail >= max_sz) SetError(OVERFLOW_ERR, func, 251);
- if(r < 0){ n--; r += DFIGURES; } //When p < 0 it makes r > 0.
-
- if(n) MultPowRdx((int)n); //Do not use y *= pow10(p) to avoid the overflow.
- if(r) *this = LsMult( *this, (ulong)ipow10((int)r) );
- return *this;
- }
slmmlp10.cpp : last modifiled at 2015/11/27 14:13:55(833 bytes)
created at 2017/10/07 10:26:50
The creation time of this html file is 2017/11/09 14:52:03 (Thu Nov 09 14:52:03 2017).